/*
 * @(#)MaintUpdateAlertForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.alert.web;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.alert.bean.UpdateAlert;
import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.web.AbstractActionForm;

/**
  MaintUpdateAlertForm.java

  This class is the for web form purpose.

  @author      Zoe Shum
  @company     DCIVision Limited
  @creation date   20/02/2004
  @version     $Revision: 1.9 $
*/

public class MaintUpdateAlertForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.9 $";


  private String objectType = null;
  private String objectID = null;
  private String objectName = null;

  private String alertType = null;
  private String alertSubject=null;
  private String message = null;
  private String dueDate = null;

  private String[] actionType = null;
  private String[] notifyWay = null;
  private String[] userList = null;
  private String[] groupList = null;
  private String[] roleList = null;
  private String[] contactList = null;
  private String[] contactPersonList = null;

  private String curFunctionCode = null;
  //Options for delete old system logs when update/delete
  private boolean bClearLogs = false;

  /* parameters for email to external user */
  private String sender = null;
  private String recipients = null;
  private String ccRecipients = null;
  private String bccRecipients = null;
  private String subject = null;
  private String content = null;
  
  private String notifySelf = null;

  public MaintUpdateAlertForm() {
    super();
  }

  public String getObjectType() {
    return(this.objectType);
  }

  public void setObjectType(String objectType) {
    this.objectType = objectType;
  }

  public String getObjectID() {
    return(this.objectID);
  }

  public void setObjectID(String objectID) {
    this.objectID = objectID;
  }

  public String getObjectName() {
    return(this.objectName);
  }

  public void setObjectName(String objectName) {
    this.objectName = objectName;
  }

  public String getAlertType() {
    return (this.alertType);
  }

  public void setAlertType(String alertType) {
    this.alertType = alertType;
  }

  public String getMessage() {
    return (this.message);
  }

  public void setMessage(String message) {
    this.message = message;
  }

  public String getDueDate() {
    return(this.dueDate);
  }

  public void setDueDate(String dueDate) {
    this.dueDate = dueDate;
  }


  public String[] getActionType() {
    return(this.actionType);
  }

  public void setActionType(String[] actionType) {
    this.actionType = actionType;
  }

  public String[] getNotifyWay() {
    return(this.notifyWay);
  }

  public void setNotifyWay(String[] notifyWay) {
    this.notifyWay = notifyWay;
  }

  public String getCurFunctionCode() {
    return curFunctionCode;
  }

  public void setCurFunctionCode(String curFunctionCode) {
    this.curFunctionCode = curFunctionCode;
  }

  public String[] getUserList(){
    return this.userList;
  }

  public void setUserList(String[] userList){
    this.userList=userList;
  }

  public String[] getGroupList(){
    return this.groupList;
  }

  public void setGroupList(String[] groupList){
    this.groupList=groupList;
  }

  public String[] getRoleList(){
    return this.roleList;
  }

  public void setRoleList(String[] roleList){
    this.roleList=roleList;
  }

  public boolean getClearLogs(){
    return this.bClearLogs;
  }

  public void setClearLogs(boolean bClearLogs){
    this.bClearLogs=bClearLogs;
  }

  public String getSender() {
    return(this.sender);
  }

  public void setSender(String sender) {
    this.sender = sender;
  }

  public String getRecipients() {
    return(this.recipients);
  }

  public void setRecipients(String recipients) {
    this.recipients = recipients;
  }

  public String getCCRecipients() {
    return(this.ccRecipients);
  }

  public void setCCRecipients(String ccRecipients) {
    this.ccRecipients = ccRecipients;
  }

  public String getBCCRecipients() {
    return(this.bccRecipients);
  }

  public void setBCCRecipients(String bccRecipients) {
    this.bccRecipients = bccRecipients;
  }

  public String getSubject() {
    return(this.subject);
  }

  public void setSubject(String subject) {
    this.subject = subject;
  }

  public String getContent() {
    return(this.content);
  }

  public void setContent(String content) {
    this.content = content;
  }
  
  public String[] getContactList(){
    return this.contactList; 
  }
  
  public void setContactList(String[] contactList){
    this.contactList=contactList; 
  }
  
  public String[] getContactPersonList(){
    return this.contactPersonList; 
  }
  
  public void setContactPersonList(String[] contactPersonList){
    this.contactPersonList=contactPersonList; 
  }

  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    this.setObjectType(null);
    this.setObjectID(null);
    this.setDueDate(null);
    this.setMessage(null);
    this.setActionType(null);
    this.setNotifyWay(null);
    this.setClearLogs(false);

    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);
    this.setNotifySelf(null);
  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    UpdateAlert tmpUpdateAlert = new UpdateAlert();
    tmpUpdateAlert.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpUpdateAlert.setObjectType(this.getObjectType());
    tmpUpdateAlert.setObjectID(TextUtility.parseIntegerObj(this.getObjectID()));
    tmpUpdateAlert.setDueDate(parseTimestamp(this.getDueDate()));
    tmpUpdateAlert.setMessage(this.getMessage());
    tmpUpdateAlert.setClearLogs(this.bClearLogs);
    tmpUpdateAlert.setRecordStatus(this.getRecordStatus());
    tmpUpdateAlert.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpUpdateAlert.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpUpdateAlert.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpUpdateAlert.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpUpdateAlert.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    tmpUpdateAlert.setNotifySelf(this.getNotifySelf());
    tmpUpdateAlert.setAlertSubject(this.getAlertSubject());
    return tmpUpdateAlert;
  }

  public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
    UpdateAlert tmpUpdateAlert = (UpdateAlert)baseObj;
    this.setObjectType(tmpUpdateAlert.getObjectType());
    this.setObjectID(TextUtility.formatIntegerObj(tmpUpdateAlert.getObjectID()));
    this.setDueDate(formatTimestamp(tmpUpdateAlert.getDueDate()));
    this.setMessage(tmpUpdateAlert.getMessage());
    this.setClearLogs(tmpUpdateAlert.getClearLogs());
    this.setRecordStatus(tmpUpdateAlert.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpUpdateAlert.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpUpdateAlert.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpUpdateAlert.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpUpdateAlert.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpUpdateAlert.getUpdateDate()));
    this.setNotifySelf(tmpUpdateAlert.getNotifySelf());
    this.setAlertSubject(tmpUpdateAlert.getAlertSubject());
  }

	public String getNotifySelf() {
		return notifySelf;
	}

	public void setNotifySelf(String notifySelf) {
		this.notifySelf = notifySelf;
	}

  public String getAlertSubject() {
    return alertSubject;
  }

  public void setAlertSubject(String alertSubject) {
    this.alertSubject = alertSubject;
  }


}
